<template>
  <div class="son">
    <h2>child1</h2>
    <h4>玩具: {{ toy }}</h4>
    <h4>书籍: {{ book }}本</h4>
    <button @click="minusHouse($parent)">干掉父的房产</button>
  </div>
</template>

<script setup lang="ts">
import { ref , defineExpose} from 'vue'

let toy = ref('奥特曼')
let book = ref(3)

defineExpose({toy, book})

const minusHouse = (parent:any) => {
  console.log(parent) // 父组件实例对象
  parent.house -= 1
}

</script>

<style scoped>
  .son {
    background: skyblue;
  }
</style>

